﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Fitness_club
{
    public partial class DbBackUpForm : Form
    {
        public static string constr = ConfigurationManager.AppSettings["ConStr"];
        SqlConnection con = new SqlConnection(constr);
        
        public DbBackUpForm()
        {
            InitializeComponent();
        }

        private void buttonBackUp_Click(object sender, EventArgs e)
        {
            try
            {
                SqlCommand objCmd = new SqlCommand("pr_GetBackUp",con);

                con.Open();
                objCmd.ExecuteNonQuery();
                MessageBox.Show("DB Backup Successful", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception Ex)
            {
                MessageBox.Show("Error in DB Backup", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                con.Close();
            }
        }
    }
}
